package keeto.com.vn.bms.network.task;

import java.io.IOException;

import keeto.com.vn.bms.config.IBMSCore;
import keeto.com.vn.bms.network.request.GetListHintsRequest;
import keeto.com.vn.bms.network.response.GetListHintsResponse;
import keeto.com.vn.bms.utils.BMSListener;

import org.apache.http.client.ClientProtocolException;
import org.json.JSONException;

public class TaskGetListHints extends AbstractTask{

	private String AuthKey;
	

	public TaskGetListHints(BMSListener listener, IBMSCore core, String authKey) {
		super(listener, core);
		AuthKey = authKey;
	}

	@Override
	public void run() throws ClientProtocolException, JSONException,
			IOException {
		// TODO Auto-generated method stub
		GetListHintsRequest request = new GetListHintsRequest();
		request.setAuthKey(AuthKey);
		GetListHintsResponse response = protocol.GetListHints(request);
		for (BMSListener mlistener : listener){
			mlistener.finishGetListHints(response.getReturnCode(),response.getResuiltMsg(),response.getArrHints());
		}
	}

	@Override
	public void timeoutCallback() {
		for (BMSListener mlistener : listener){
			mlistener.finishGetListHints(protocol.STATUS_CODE_GENERIC_FAIL_CONECTTION, null,null);
		}
	}

}
